package com.tentact.coolmeetingtest.dao;

import com.tentact.coolmeetingtest.util.JDBCUtil;
import com.tentact.coolmeetingtest.util.OtherUtil;
import com.tentact.coolmeetingtest.vo.Dept;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
 * @author 星环
 * @date 2023/1/10 19:22:14
 * @description
 */
public class DeptDao {

    public int addDept(String name) {
        return (Integer) JDBCUtil.excute("insert into dept values(null,?)", Integer.class, name);

    }

    public List<Dept> getAllDept() {
        return (List<Dept>) JDBCUtil.excute("select * from dept",Dept.class);
    }

    public int deleteDept(Integer i) {
        return (Integer) JDBCUtil.excute("delete from dept where deptno = ?", Integer.class, i);
    }

    public int updateDept(Integer i, String deptName) {
       return (Integer) JDBCUtil.excute("update dept set dept_name = ? where deptno = ?", Integer.class, deptName, i);

    }
}
